#pragma once


// UTabCtrl
#include <afxtempl.h>
#include "YMemDC.h"
class UTabItem;

#define MSG_UTABCTRL (WM_USER + 100)

class UTabCtrl : public CWnd
{
	DECLARE_DYNAMIC(UTabCtrl)

public:
	UTabCtrl();
	virtual ~UTabCtrl();

protected:
	DECLARE_MESSAGE_MAP()
public:
	void SetBackgroundColor(COLORREF cor);
	COLORREF GetBackgroundColor();

protected:
	COLORREF m_corBackground;
	COLORREF m_corTopBorder;
	COLORREF m_corBottomBorder;
	COLORREF m_corLeftBorder;
	COLORREF m_corRightBorder;
	COLORREF m_corActiveItemBackground;
	HWND m_hWndNewParent;
	int m_nCurSel;
	CTypedPtrList<CPtrList,UTabItem*> m_TabItemList;
	int m_nItemHeight;
	int m_nItemWidth;
	int m_nItemSpan;
	CWnd* m_pOwnerWnd;
public:
	afx_msg void OnPaint();
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	void DrawBackground(CDC* pDC,CRect& rcClient);
	void DrawItem(CDC* pDC);
	void SetBorderColor(COLORREF corLeft,COLORREF corTop,COLORREF corRight,COLORREF corBottom);
	void GetBorderColor(COLORREF& corLeft,COLORREF& corTop,COLORREF& corRight,COLORREF& corBottom);
	BOOL SetItem(int nItem,UTabItem* pUTabItem);
	void SetCurSel(int nItem);
	int GetCurSel();
	void SetItemWidth(int nWidth);
	int GetItemWidth();
	void SetItemHeight(int nHeight);
	int GetItemHeight();
	void SetItemSpan(int nSpan);
	int GetItemSpan();
	void SetActiveItemBackground(COLORREF cor);
	COLORREF GetActiveItemBackground();
	void SetOwnerWnd(CWnd* pWnd);
	CWnd* GetOwnerWnd();
};


